package co.baiku.boot.component.core.type;

import co.baiku.boot.common.type.IEnum;

import java.util.HashMap;
import java.util.Map;

public enum PayChannelType implements IEnum<PayChannelType, Integer> {
    Balance(0, "余额支付"),
    Wechat(1, "微信支付"),
    Alipay(2, "支付宝支付"),
    UnionPay(3, "支付宝支付"),
    Unkown(99, "其他");

    Integer value;
    String description;

    private final static Map<Integer, PayChannelType> CACHE = new HashMap<>();

    PayChannelType(Integer value, String description) {
        this.description = description;
        this.value = value;
    }

    @Override
    public Integer getValue() {
        return null;
    }

    @Override
    public String getDescription() {
        return null;
    }

    @Override
    public PayChannelType parseValue(Integer value) {
        if (CACHE.isEmpty()) {
            for (PayChannelType payChannelType : values()) {
                CACHE.put(payChannelType.getValue(), payChannelType);
            }
        }
        return CACHE.get(value);
    }
}
